/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fanta.framework.persistence;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author alessandro
 */
@Entity
@Table(name = "date_giornate")
@NamedQueries({
    @NamedQuery(name = "DateGiornate.findAll", query = "SELECT d FROM DateGiornate d"),
    @NamedQuery(name = "DateGiornate.findByData", query = "SELECT d FROM DateGiornate d WHERE d.data = :data")})
public class DateGiornate implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "data")
    @Temporal(TemporalType.DATE)
    private Date data;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "data")
    private Collection<Voti> votiCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "data")
    private Collection<Giornatelega> giornatelegaCollection;

    public DateGiornate() {
    }

    public DateGiornate(Date data) {
        this.data = data;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public Collection<Voti> getVotiCollection() {
        return votiCollection;
    }

    public void setVotiCollection(Collection<Voti> votiCollection) {
        this.votiCollection = votiCollection;
    }

    public Collection<Giornatelega> getGiornatelegaCollection() {
        return giornatelegaCollection;
    }

    public void setGiornatelegaCollection(Collection<Giornatelega> giornatelegaCollection) {
        this.giornatelegaCollection = giornatelegaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (data != null ? data.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DateGiornate)) {
            return false;
        }
        DateGiornate other = (DateGiornate) object;
        if ((this.data == null && other.data != null) || (this.data != null && !this.data.equals(other.data))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fanta.framework.persistence.DateGiornate[data=" + data + "]";
    }

}
